Open
Conversation
* feat: replace js render to template * feat: add extra tables to template * ci: update release steps * test: add unit tests * ci: change test trigger branch * ci: change test trigger branch * fix: change path for testing * ci: add checkout * fix: add changes according PR reviews * test: update testdata * fix: add centering for fixed version * docs: update README.md * chore: add cmd short description
nikpivkin
reviewed
Dec 19, 2024
render/render.go
Outdated
| var htmlTmpl []byte | ||
|
|
||
| type Data struct { | ||
| Results types.Results |
Collaborator
There was a problem hiding this comment.
Since the graph uses only the Results field from the report, you can change the js logic and pass only the results to the template
Collaborator
|
@olsova @afdesk The template becomes very large. What if we use the following approach? This will allow vendor files to be included in the binary. //go:embed templates/*
var templates embed.FS
func main() {
templateFS, err := fs.Sub(templates, "templates")
if err != nil {
panic(err)
}
t, err := template.ParseFS(templateFS, "*.js", "*.tpl", "*.css")
if err != nil {
panic(err)
}
if err := t.ExecuteTemplate(os.Stdout, "index.tpl", map[string]any{}); err != nil {
panic(err)
}
}We can include other templates (or just files) in the main template: ❯ cat templates/index.tpl
{{template "index.js" .}}% |
nikpivkin
reviewed
Dec 25, 2024
nikpivkin
reviewed
Dec 25, 2024
nikpivkin
requested changes
Dec 25, 2024
Collaborator
nikpivkin
left a comment
There was a problem hiding this comment.
Left a couple of small comments
nikpivkin
reviewed
Dec 25, 2024
Collaborator
|
Maybe rename template to templates? |
nikpivkin
approved these changes
Dec 25, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.